import type { JestConfigWithTsJest } from "ts-jest";

const jestConfig: JestConfigWithTsJest = {
  preset: "ts-jest/presets/js-with-ts-esm",
  extensionsToTreatAsEsm: [".ts", ".mts"],
  testEnvironment: "jsdom",
  testEnvironmentOptions: {
    html: `<!DOCTYPE html>
  <html lang="zh-CN">
    <head>
      <meta charset="utf-8" />
      <meta name="viewport"
        content="width=device-width, initial-scale=1"
      />
      <title>Jest DOM</title>
    </head>
    <body>
      <header></header>
      <main></main>
      <footer></footer>
    </body>
  </html>`,
    url: "https://www.example.com/index.html",
  },
  setupFilesAfterEnv: ["../jest.setup.ts"],
  rootDir: "./projects",
};

export default jestConfig;
